<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var salary = [1500,1200,2000,2100,1800];
        var newArr = [];
        for (var i = 0;i<salary.length;i++){
            // if (salary[i] >=2000){
            //     salary.shift();
            // }else {
            //     newArr[newArr.length] = salary[i];
            // }
            if (salary[i] < 2000){
                newArr.push(salary[i]);
            }
        }
        console.log(newArr);

    </script>
</head>
<body>

</body>
</html>